<div class="wrapper-1">
  <div class="wrapper-2">
    <div class="wrapper-3">
      <div class="left-bg">
        <div class="right-bg">
          <div id="middle">
            <div id="middle-expand">
              <div id="main">
                <div id="main-shift">
                  <div class="contentleft-bg">
                    <div class="contentright-bg">
                      <div id="mainmiddle">
                        <div id="mainmiddle-expand">
                          <div id="content">
                            <div id="content-shift">
                              <div id="breadcrumbs"> <span class="breadcrumbs"> <a href="#">Home</a><a href="#">Schedule 2013</a><a href="#">Hanoi</a><span class="current">Train from <?php echo $result['fromname']." to ".$result['toname']; ?></span></span> </div>
                              <div id="component" class="floatbox">
                                <div class="joomla columnwidth-310">
                                  <div class="article">
                                    <h2 style=" text-align:center">Train fares for all trains departing from <?php echo $result['fromname']." to ".$result['toname']; ?><br>
                                      Unit: USD</h2>
                                    <h3>Train from <?php echo $result['fromname']." to ".$result['toname']; ?></h3>
                                    <input type="hidden" id="trainname" value="test" />
                                    <script type="text/javascript">
									  $(document).ready(function(){
										  $(document).on("click",".radprice",function(){
											  $trainame = $("#trainname").val();
											  $type = $(this).attr("datatype");
											  $id  = $(this).attr("dataid");
											  $from = $(this).attr("datafrom"); 
											  $to = $(this).attr("datato");
											  $dastart = $(this).attr("datastart");
											  $daend = $(this).attr("dataend");
											  if($(".radprice"+$id).is(":checked")){
												  $obj = $("input[class='radprice"+$id+"']:checked");
												  $val = $obj.val();
												  $name = $obj.attr("dataname");
												  $train = $obj.attr("datatrain");
												  jQuery.post("<?php echo base_url()."home/cart/addorther"; ?>",{id:$id,type:$type,val:$val,name:$name,trainame:$trainame,from:$from,to:$to,start:$dastart,end:$daend,train:$train},function(result){
												  	 $("#cart").load("<?php echo base_url(); ?>home/cart");
											  	  });
											  }else{
												  alert("Please select a cabin!");
												  return false;
											  }
										  });
									  });
                                  </script>
                                    <table class="trains" style="width:715px;">
                                      <thead>
                                        <tr>
                                          <th scope="col">Departs</th>
                                          <th scope="col">Arrives</th>
                                          <th scope="col">Train No</th>
                                          <th scope="col">Hard Seat</th>
                                          <th scope="col">Soft Seat</th>
                                          <th scope="col">Hard Berth(6)</th>
                                          <th scope="col">Soft Berth(4)</th>
                                          <th scope="col"></th>
                                        </tr>
                                      </thead>
                                      <tbody>
                                      <?php if(isset($listticket) && $listticket != NULL){ ?>
                                       <?php foreach($listticket as $ticket){ ?>
                                        <tr>
                                          <td><?php echo $ticket['tickdeparts']; ?></td>
                                          <td><?php echo $ticket['tickarrives']; ?></td>
                                          <td><a href="javascript:void(0)"><span style="color:#F60"><?php echo $ticket['train_name']; ?></span></a> <b><?php echo $ticket['train_code']; ?></b></td>
                                          <td><?php if($ticket['softseat'] != 0){ echo "<span><input class='radprice".$ticket['tickid']."' dataname='Hard Seat' datatrain='".$ticket['train_name']."' value='".$ticket['softseat']."' name='rooms' type='radio' />&nbsp;$".$ticket['softseat']."</span>"; }else{ echo "<span>N/A</span>";} ?></td>
                                          <td><?php if($ticket['hardberth'] != 0){ echo "<span><input class='radprice".$ticket['tickid']."' dataname='Soft Seat' datatrain='".$ticket['train_name']."' value='".$ticket['hardberth']."' name='rooms' type='radio' />&nbsp;$".$ticket['hardberth']."</span>"; }else{ echo "<span>N/A</span>";} ?></td>
                                          <td><?php if($ticket['softberth'] != 0){ echo "<span><input class='radprice".$ticket['tickid']."' dataname='Hard Berth' datatrain='".$ticket['train_name']."' value='".$ticket['softberth']."' name='rooms' type='radio' />&nbsp;$".$ticket['softberth']."</span>"; }else{ echo "<span>N/A</span>";} ?></td>
                                          <td><?php if($ticket['vipberth'] != 0){ echo "<span><input class='radprice".$ticket['tickid']."' dataname='Soft Berth' datatrain='".$ticket['train_name']."' value='".$ticket['vipberth']."' name='rooms' type='radio' />&nbsp;$".$ticket['vipberth']."</span>"; }else{ echo "<span>N/A</span>";} ?></td>
                                          <td><span class="booking"><a href="javascript:void(0)" <?php echo "datatype='1' datafrom='".$result['fromname']."' datato='".$result['toname']."' datastart='".$ticket['tickdeparts']."' dataend='".$ticket['tickarrives']."' dataid='".$ticket['tickid']."'"; ?> title="Book" class="radprice">Book</a></span></td>
                                        </tr>
                                        <?php } }else{ ?>
                                        <tr>
                                        	<td colspan="8" height="50">No tickets available</td>
                                        </tr>
                                        <?php } ?>
                                      </tbody>
                                    </table>
                                    <a href="javascript:void(0)" class="show_hide">Please select a returning train?</a><br>
                                    <div style="display: none;" class="slidingDiv">
                                      <h3>Train return from Danang to Hanoi</h3>
                                      <table class="trains" style="width: 715px;">
                                        <thead>
                                          <tr>
                                            <th scope="col">Departs</th>
                                            <th scope="col">Arrives</th>
                                            <th scope="col">Train No</th>
                                            <th scope="col">Hard Seat</th>
                                            <th scope="col">Soft Seat</th>
                                            <th scope="col">Hard Berth(6)</th>
                                            <th scope="col">Soft Berth(4)</th>
                                            <th scope="col"></th>
                                          </tr>
                                        </thead>
                                        <tbody>
                                          <tr>
                                            <td>11:51</td>
                                            <td>04:02</td>
                                            <td><a href="/train/SapaTourist/reunification-express-train" target="_blank"><span style="color:#F60">Reunification Express Train</span></a> <b>SE2</b></td>
                                            <td><input name="138" value="1_38" type="radio">
                                              $38</td>
                                            <td><input name="138" value="2_43" type="radio">
                                              $43</td>
                                            <td><input name="138" value="3_59" type="radio">
                                              $59</td>
                                            <td><input name="138" value="4_61" type="radio">
                                              $61</td>
                                            <td><span class="booking"><a href="javascript:void(0)" onclick="javascript:addTicket(138)" title="Book">Book</a></span></td>
                                          </tr>
                                          <tr>
                                            <td>14:30</td>
                                            <td>05:00</td>
                                            <td><a href="/train/SapaTourist/reunification-express-train" target="_blank"><span style="color:#F60">Reunification Express Train</span></a> <b>SE4</b></td>
                                            <td><i>N/A</i></td>
                                            <td><input name="139" value="2_45" type="radio">
                                              $45</td>
                                            <td><input name="139" value="3_61" type="radio">
                                              $61</td>
                                            <td><input name="139" value="4_63" type="radio">
                                              $63</td>
                                            <td><span class="booking"><a href="javascript:void(0)" onclick="javascript:addTicket(139)" title="Book">Book</a></span></td>
                                          </tr>
                                          <tr>
                                            <td>02:21</td>
                                            <td>19:26</td>
                                            <td><a href="/train/SapaTourist/reunification-express-train" target="_blank"><span style="color:#F60">Reunification Express Train</span></a> <b>SE6</b></td>
                                            <td><input name="140" value="1_38" type="radio">
                                              $38</td>
                                            <td><input name="140" value="2_43" type="radio">
                                              $43</td>
                                            <td><input name="140" value="3_57" type="radio">
                                              $57</td>
                                            <td><input name="140" value="4_59" type="radio">
                                              $59</td>
                                            <td><span class="booking"><a href="javascript:void(0)" onclick="javascript:addTicket(140)" title="Book">Book</a></span></td>
                                          </tr>
                                          <tr>
                                            <td>23:12</td>
                                            <td>15:28</td>
                                            <td><a href="/train/SapaTourist/reunification-express-train" target="_blank"><span style="color:#F60">Reunification Express Train</span></a> <b>SE8</b></td>
                                            <td><input name="141" value="1_38" type="radio">
                                              $38</td>
                                            <td><input name="141" value="2_43" type="radio">
                                              $43</td>
                                            <td><input name="141" value="3_57" type="radio">
                                              $57</td>
                                            <td><input name="141" value="4_59" type="radio">
                                              $59</td>
                                            <td><span class="booking"><a href="javascript:void(0)" onclick="javascript:addTicket(141)" title="Book">Book</a></span></td>
                                          </tr>
                                          <tr>
                                            <td>18:30</td>
                                            <td>11:45</td>
                                            <td><a href="/train/SapaTourist/reunification-express-train" target="_blank"><span style="color:#F60">Reunification Express Train</span></a> <b>SE20</b></td>
                                            <td><i>N/A</i></td>
                                            <td><input name="265" value="2_42" type="radio">
                                              $42</td>
                                            <td><input name="265" value="3_54" type="radio">
                                              $54</td>
                                            <td><input name="265" value="4_57" type="radio">
                                              $57</td>
                                            <td><span class="booking"><a href="javascript:void(0)" onclick="javascript:addTicket(265)" title="Book">Book</a></span></td>
                                          </tr>
                                        </tbody>
                                      </table>
                                    </div>
                                    <p></p>
                                    <div class="trainfom"><?php echo $result['destination']; ?></div>
                                    <div><br>
                                    </div>
                                  </div>
                                </div>
                              </div>
                            </div>
                          </div>
                          <!-- content end --> 
                        </div>
                      </div>
                      <!-- mainmiddle end --> 
                    </div>
                  </div>
                </div>
              </div>
              <div id="right" style="min-height: 955px; ">
                <?php $this->load->view("public/tickets"); ?>
                <?php $this->load->view("public/advs"); ?>
              </div>
            </div>
          </div>
        </div>
      </div>
    </div>
  </div>
</div>
<div class="wrapper-b1">
  <div class="wrapper-b2">
    <div class="wrapper-b3"></div>
  </div>
</div>
</div>
</div>
</div>
